## API Report File for "@backstage/plugin-search-backend-node"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts
/// <reference types="node" />

import { Config } from '@backstage/config';
import { DocumentCollatorFactory } from '@backstage/plugin-search-common';
import { DocumentDecoratorFactory } from '@backstage/plugin-search-common';
import { DocumentTypeInfo } from '@backstage/plugin-search-common';
import { IndexableDocument } from '@backstage/plugin-search-common';
import { IndexableResultSet } from '@backstage/plugin-search-common';
import { Logger } from 'winston';
import { default as lunr_2 } from 'lunr';
import { Permission } from '@backstage/plugin-permission-common';
import { QueryTranslator } from '@backstage/plugin-search-common';
import { Readable } from 'stream';
import { SearchEngine } from '@backstage/plugin-search-common';
import { SearchQuery } from '@backstage/plugin-search-common';
import { TaskFunction } from '@backstage/backend-tasks';
import { TaskRunner } from '@backstage/backend-tasks';
import { Transform } from 'stream';
import { UrlReader } from '@backstage/backend-common';
import { Writable } from 'stream';

// @public
export abstract class BatchSearchEngineIndexer extends Writable {
  constructor(options: BatchSearchEngineOptions);
  abstract finalize(): Promise<void>;
  abstract index(documents: IndexableDocument[]): Promise<void>;
  abstract initialize(): Promise<void>;
}

// @public
export type BatchSearchEngineOptions = {
  batchSize: number;
};

// @public
export type ConcreteLunrQuery = {
  lunrQueryBuilder: lunr_2.Index.QueryBuilder;
  documentTypes?: string[];
  pageSize: number;
};

// @public
export abstract class DecoratorBase extends Transform {
  constructor();
  abstract decorate(
    document: IndexableDocument,
  ): Promise<IndexableDocument | IndexableDocument[] | undefined>;
  abstract finalize(): Promise<void>;
  abstract initialize(): Promise<void>;
}

// @public
export class IndexBuilder {
  constructor(options: IndexBuilderOptions);
  addCollator(options: RegisterCollatorParameters): void;
  addDecorator(options: RegisterDecoratorParameters): void;
  build(): Promise<{
    scheduler: Scheduler;
  }>;
  getDocumentTypes(): Record<string, DocumentTypeInfo>;
  getSearchEngine(): SearchEngine;
}

// @public
export type IndexBuilderOptions = {
  searchEngine: SearchEngine;
  logger: Logger;
};

// @public
export type LunrQueryTranslator = (query: SearchQuery) => ConcreteLunrQuery;

// @public
export class LunrSearchEngine implements SearchEngine {
  constructor(options: { logger: Logger });
  // (undocumented)
  protected docStore: Record<string, IndexableDocument>;
  // (undocumented)
  getIndexer(type: string): Promise<LunrSearchEngineIndexer>;
  // (undocumented)
  protected highlightPostTag: string;
  // (undocumented)
  protected highlightPreTag: string;
  // (undocumented)
  protected logger: Logger;
  // (undocumented)
  protected lunrIndices: Record<string, lunr_2.Index>;
  // (undocumented)
  query(query: SearchQuery): Promise<IndexableResultSet>;
  // (undocumented)
  setTranslator(translator: LunrQueryTranslator): void;
  // (undocumented)
  protected translator: QueryTranslator;
}

// @public
export class LunrSearchEngineIndexer extends BatchSearchEngineIndexer {
  constructor();
  // (undocumented)
  buildIndex(): lunr_2.Index;
  // (undocumented)
  finalize(): Promise<void>;
  // (undocumented)
  getDocumentStore(): Record<string, IndexableDocument>;
  // (undocumented)
  index(documents: IndexableDocument[]): Promise<void>;
  // (undocumented)
  initialize(): Promise<void>;
}

// @public
export class MissingIndexError extends Error {
  constructor(message?: string, cause?: Error | unknown);
  readonly cause?: Error | undefined;
}

// @public
export class NewlineDelimitedJsonCollatorFactory
  implements DocumentCollatorFactory
{
  static fromConfig(
    _config: Config,
    options: NewlineDelimitedJsonCollatorFactoryOptions,
  ): NewlineDelimitedJsonCollatorFactory;
  // (undocumented)
  getCollator(): Promise<Readable>;
  // (undocumented)
  readonly type: string;
  // (undocumented)
  readonly visibilityPermission: Permission | undefined;
}

// @public
export type NewlineDelimitedJsonCollatorFactoryOptions = {
  type: string;
  searchPattern: string;
  reader: UrlReader;
  logger: Logger;
  visibilityPermission?: Permission;
};

// @public
export interface RegisterCollatorParameters {
  factory: DocumentCollatorFactory;
  schedule: TaskRunner;
}

// @public
export interface RegisterDecoratorParameters {
  factory: DocumentDecoratorFactory;
}

// @public
export class Scheduler {
  constructor(options: { logger: Logger });
  addToSchedule(options: ScheduleTaskParameters): void;
  start(): void;
  stop(): void;
}

// @public
export type ScheduleTaskParameters = {
  id: string;
  task: TaskFunction;
  scheduledRunner: TaskRunner;
};

// @public
export class TestPipeline {
  execute(): Promise<TestPipelineResult>;
  static fromCollator(collator: Readable): TestPipeline;
  static fromDecorator(decorator: Transform): TestPipeline;
  static fromIndexer(indexer: Writable): TestPipeline;
  withCollator(collator: Readable): this;
  withDecorator(decorator: Transform): this;
  withDocuments(documents: IndexableDocument[]): TestPipeline;
  withIndexer(indexer: Writable): this;
  // @deprecated
  static withSubject(subject: Readable | Transform | Writable): TestPipeline;
}

// @public
export type TestPipelineResult = {
  error: unknown;
  documents: IndexableDocument[];
};
```
